package com.igroupes.ovineherd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.igroupes.ovineherd.entity.DataModelTableEntity;
import com.igroupes.ovineherd.query.FieldDeleteQuery;
import com.igroupes.ovineherd.query.ModelDataJsonTableQuery;
import com.igroupes.ovineherd.query.TableFieldQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface DataModelTableMapper extends BaseMapper<DataModelTableEntity> {
    /**
     * 创建表
     */
    int createTable(TableFieldQuery tableFieldQuery);

    /**
     * 添加字段
     */
    int addField(@Param("fieldQueries") TableFieldQuery addFieldQuery);

    /**
     * 编辑字段
     * @param addFieldQuery
     * @return
     */
    int editField(@Param("fieldQueries") TableFieldQuery addFieldQuery);
    /**
     * 删除字段
     * @param fieldDeleteQuery
     * @return
     */
    int deleteField(@Param("field") FieldDeleteQuery fieldDeleteQuery);


    /**
     * 获得所有模型，json值
     * @return
     */
    List<ModelDataJsonTableQuery> tableJsonAll(@Param("userId")  Long userId);
    /**
     * 获得所有模型，json值
     * @return
     */
    List<ModelDataJsonTableQuery> tableJsonAllTables(@Param("userId")  Long userId, @Param("versionId") Long versionId);

    /**
     * 获得模型详情
     * @param tableId
     * @return
     */
    ModelDataJsonTableQuery tableJsonInfo(@Param("tableId") Long tableId );

    int deleteTable(@Param("map") Map map);

    int order(@Param("map") Map map);
}
